using System;
using System.Collections.Generic;
using System.Text;

using phorm.database.core;

namespace phorm.model.fields
{
    /// <summary>
    /// Abstract class that defines basic many-to-many column functionality.
    /// </summary>
    public abstract class BaseManyToMany : DatabaseColumn
    {
        /// <summary>
        /// The table in which to use for the many-to-many relationship.
        /// </summary>
        public string pivot_table;

        /// <summary>
        /// Method used to generate the create query from the related model object
        /// </summary>
        /// <returns>pivot table create query</returns>
        public string create()
        {
            return this._model.createManyToMany(this);
        }

        /// <summary>
        /// Required method needed to get all records related through this column.
        /// </summary>
        /// <returns>List of database records related to through this column.</returns>
        virtual public List<DatabaseRecord> all()
        {
            return null;
        }
    }
}
